package com.zsr.web.controller.message;


import com.zsr.common.enums.job.JobGroup;
import com.zsr.quartz.service.ISysJobService;
import com.zsr.system.service.zfb.IAliPayService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Lazy;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * 支付宝回调，消息订阅
 */
@Slf4j
@EnableAsync
@RestController
@RequestMapping("/aliPay")
public class AliPayController {

    @Resource
    private IAliPayService iAliPayService;


    /**
     * 支付宝支付回调
     * @param request 支付宝请求参数
     * @return 是否成功
     */
    @PostMapping("/notify")
    public String PhonePayNotify(HttpServletRequest request) {
        String msg = iAliPayService.phonePayNotify(request);
        if (msg.equals("success")){
            //业务操作
            String orderId = request.getParameter("out_trade_no");
        }
        return msg;
    }
}
